﻿using DXApplicationTangche.DTO.坚山;
using DXApplicationTangche.service.redis_service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.坚山
{
    public partial class Form坚山新增款式 : DevExpress.XtraEditors.XtraForm
    {
        public String styleId;
        public String styleName;
        public Form坚山新增款式()
        {
            InitializeComponent();
        }
        public Form坚山新增款式(String styleId, String styleName)
        {
            InitializeComponent();
            this.textBox款式id.Text = styleId;
            this.textBox款式名称.Text = styleName;
        }
        private void simpleButton保存_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(this.textBox款式id.Text) || String.IsNullOrEmpty(this.textBox款式名称.Text))
            {
                MessageBox.Show("请填写完整");
                return;
            }
            else
            {
                this.styleId = this.textBox款式id.Text;
                this.styleName = this.textBox款式名称.Text;
                new 坚山基本信息Service().save坚山基本信息(this.addStyle(this.styleId, this.styleName));
                this.Close();
            }
        }
        public DTO坚山款式 addStyle(String styleId, String styleName)
        {
            DTO坚山款式 DTO坚山款式 = new 坚山基本信息Service().get坚山基本信息();
            DTO坚山款式.key = "1";  //  
            if (!String.IsNullOrEmpty(styleId) && !String.IsNullOrEmpty(styleName))
            {
                DTO坚山款式.DTO款式s.Add(new DTO款式(styleId, styleName));
            }
            return DTO坚山款式;
        }
    }
}
